﻿/// <reference path="../lib/amplify.js" />

/**
 @title:        dataservice.activities
 @description:  Responsible for communications with Activities services to receive data from there.
 @author:       Yuriy Shapovalov               
 */

define('dataservice.activities',
    ['amplify'],
    function () {
        var
            /**
             @description: Initialize requests to server using amplify.js library
             */
            init = function () {
                amplify.request.define('activities', 'ajax', {
                    url: '/api/activities',
                    dataType: 'json',
                    type: 'GET'
                });
            },

            getActivities = function (callbacks) {
                return amplify.request({
                    resourceId: 'activities',
                    data: '',
                    success: callbacks.success,
                    error: callbacks.error
                });
            };

        init();

        return {
            getActivities: getActivities
        };
    });